﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:toolpanel="clr-namespace:DeepEarth.Toolkit.Controls;assembly=DeepEarth.Toolkit.Controls.ToolPanel"
    xmlns:CoordinatePanel="clr-namespace:DeepEarth.Toolkit.Controls" >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/DeepEarth.Toolkit.Common;component/Resources/CommonStyles.xaml"></ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="ClearTextBoxStyle" TargetType="TextBox">
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="Padding" Value="2"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TextBox">
                    <Grid x:Name="RootElement">
                        <ScrollViewer x:Name="ContentElement" BorderThickness="0" IsTabStop="False" Padding="{TemplateBinding Padding}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="CoordinatePanel:CoordinatePanel">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CoordinatePanel:CoordinatePanel">
                    <toolpanel:ToolPanel x:Name="PART_Layoutroot">
                        <toolpanel:ToolPanel.Resources>
                            <CoordinatePanel:CoordinateConverter x:Key="CoordinateConverter" />
                            <CoordinatePanel:CoordinateModeConverter x:Key="coordinateModeConverter" />
                        </toolpanel:ToolPanel.Resources>
                        <toolpanel:ToolPanel.Content>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="auto"></ColumnDefinition>
                                    <ColumnDefinition Width="*"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <TextBox x:Name="PART_CoordTextBox" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
                                           Text="{Binding Location,Converter={StaticResource CoordinateConverter}, Mode=TwoWay}"
                                           Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
                                           Style="{StaticResource ClearTextBoxStyle}"/>
                                <TextBox Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" 
                                           Text="{Binding ZoomLevel, Mode=TwoWay}"
                                           Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
                                           Style="{StaticResource ClearTextBoxStyle}"/>
                            </Grid>
                        </toolpanel:ToolPanel.Content>
                        <toolpanel:ToolPanel.Options>
                            <StackPanel>
                                <TextBlock Text="Change coordinate display:" />
                                <ListBox SelectedIndex="{Binding Mode, Converter={StaticResource coordinateModeConverter}, Mode=TwoWay}">
                                    <ListBox.Items>
                                        <ListBoxItem Margin="2,2,2,2" Content="Decimal" />
                                        <ListBoxItem Margin="2,2,2,2" Content="DDMMSS" />
                                        <ListBoxItem Margin="2,2,2,2" Content="UTM" />
                                    </ListBox.Items>
                                </ListBox>
                            </StackPanel>
                        </toolpanel:ToolPanel.Options>
                    </toolpanel:ToolPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

